package com.global.college.adapter;

import android.content.Intent;
import android.view.View;
import android.widget.TextView;

import com.bumptech.glide.Glide;
import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.global.college.R;
import com.global.college.data.inner.MoreLessonBean;
import com.global.college.ui.activity.WebViewActivity;
import com.global.college.views.RoundCornerImageview;

/**
 * 精选-更多好课
 */
public class MoreLessonAdapter extends BaseQuickAdapter<MoreLessonBean, BaseViewHolder> {

    public MoreLessonAdapter() {
        super(R.layout.item_more_lesson);
    }

    @Override
    protected void convert(BaseViewHolder helper, MoreLessonBean bean) {
        helper.setText(R.id.tv_lesson_name, bean.getLessonName());
        helper.setText(R.id.tv_lesson_type, bean.getLessonType());
        RoundCornerImageview iv = helper.getView(R.id.riv_lesson_pic);
        Glide.with(mContext).load(bean.getLessonPic()).into(iv);
        TextView tvType = helper.getView(R.id.tv_lesson_type);
        tvType.setCompoundDrawablesWithIntrinsicBounds(mContext.getDrawable(bean.getTypePic()), null, null, null);
        helper.itemView.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                mContext.startActivity(new Intent(mContext, WebViewActivity.class)
                        .putExtra("url", "http://h5.uton.net/rollOut").putExtra("title", "即将推出"));
            }
        });
    }

}
